package pers.cz.postgirl.core;

import pers.cz.postgirl.config.EvenType;

/**
 * @program: postgirl-client
 * @description: 方法执行前置执行事件
 * @author: Cheng Zhi
 * @create: 2023-05-28 15:19
 **/
public class BeforeEvent extends InvokeEvent {

    /**
     * 目标方法的类加载器
     */
    private ClassLoader javaClassLoader;

    /**
     * 目标类名称
     */
    private String javaClassName;

    /**
     * 目标方法名称
     */
    private String javaMethodName;

    /**
     * 目标方法描述
     */
    private String[] paramTypes;

    /**
     * 插码内容
     */
    private EnhanceModel.MethodPattern.DefaultCodePattern defaultCodePattern;

    public BeforeEvent(
            ClassLoader javaClassLoader,
            String javaClassName,
            String javaMethodName,
            String[] paramTypes,
            EnhanceModel.MethodPattern.DefaultCodePattern defaultCodePattern,
            EvenType evenType) {
        super(evenType);
        this.javaClassLoader = javaClassLoader;
        this.javaClassName = javaClassName;
        this.javaMethodName = javaMethodName;
        this.paramTypes = paramTypes;
        this.defaultCodePattern = defaultCodePattern;
    }

    public ClassLoader getJavaClassLoader() {
        return javaClassLoader;
    }

    public String getJavaClassName() {
        return javaClassName;
    }

    public String getJavaMethodName() {
        return javaMethodName;
    }

    public String[] getParamTypes() {
        return paramTypes;
    }

    public EnhanceModel.MethodPattern.DefaultCodePattern getJavaMethodContent() {
        return defaultCodePattern;
    }
}
